<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCashOrderTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cash_order', function (Blueprint $table) {
            $table->increments('id');
            $table->tinyInteger('type')->default(0)->comment('0=店铺提现,1=员工提现,2=代理商提现');
            $table->string('out_trade_no')->unique()->default('')->comment('提现单号');
            $table->integer('user_id')->default('0')->comment('用户ID');
            $table->integer('shop_id')->default('0')->comment('店铺ID');
            $table->integer('worker_id')->default('0')->comment('员工ID');
            $table->integer('agent_id')->default('0')->comment('代理商ID');
            $table->decimal('amount')->default('0.00')->comment('提现金额');
            $table->integer('user_bank_id')->default(0)->comment('用户银行卡ID');
            $table->json('banks')->nullable()->comment('用户银行卡信息');
            $table->tinyInteger('status')->default('0')->comment('审核状态:0=待审核,1=审核通过,2=审核拒绝');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('cash_order');
    }
}
